#include<iostream>
#include<cstdio>
using namespace std;
long long n,l,r,ans,l1,r1,mid,k;
long long min(long long x,long long y)
{
	if (x<y)
	{
		return x;
	}
	return y;
}
long long pd(long long x)
{
	long long minn=min(r,l/n*n+n-1);
	if (minn%n>=x)
	{
		return true;
	}
	return false;
}
int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	cin>>n>>l>>r;
	l1=0;
	r1=n-1;
	while (l1<=r1)
	{
		mid=(l1+r1)/2;
		if (pd(mid))
		{
			ans=mid;
			l1=mid+1;
		}
		else
		{
			r1=mid-1;
		}
	}
	cout<<ans;
	return 0;
}
